﻿namespace SsisLdapSource
{
    using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
    using System.Collections.Generic;
    using System.Linq;

    public partial class SsisLdapSource
    {
        private Dictionary<string, int> runTimeColumnsInfo;

        private void GenerateColumnsRunTimeInfo()
        {
           runTimeColumnsInfo = ComponentMetaData.OutputCollection[0].OutputColumnCollection
                .Cast<IDTSOutputColumn100>()
                .ToDictionary(column => column.Name, GetRunTimeColumnIndex);
        }

        private int GetRunTimeColumnIndex(IDTSOutputColumn100 column)
        {
            return BufferManager.FindColumnByLineageID(
                ComponentMetaData.OutputCollection[0].Buffer,
                column.LineageID);
        }
    }
}
